#!/bin/sh

set -e

help() {
  cat <<TXT
=== Thanks for helping with Knife-Solo! ===

The b folder contains bundler bin-stubs. These will let you test your changes more easily.

Just run:  $(cd `dirname $0`/.. && pwd )/b/knife

Use rake to run the tests and rake -T to see the options.

If you want to run integration testing grab your AWS keys from https://aws-portal.amazon.com/gp/aws/securityCredentials and enter them in test/support/config.yml. We currently also use a marketplace AMI which you'll need to accept the EULA for. Go to http://bit.ly/centos6ami to do that.

The integration tests will try to create a key pair called knife-solo. If you've already created a key pair with that name please store it in test/support/knife-solo.pem. If you need to use a different key name you can set it in test/support/config.yml
TXT
}

setup() {
  gem install bundler
  bundle --binstubs=b
  bundle exec rake
  if [[ ! -e test/support/config.yml ]]; then
    cp test/support/config.yml{.example,}
  fi
}

case $1 in
  help)
    help
    ;;
  *)
    setup
    help
    ;;
esac
